using System;
using System.Collections.Generic;
using System.Text;
using NHMA = NHibernate.Mapping.Attributes;
using Iesi.Collections;

namespace infoMECHANICA.NHibernateORM.TestMappings
{
    /// <summary>
    /// NHibernate mappings of database Jobs
    /// </summary>
    [NHMA.Class(Table = "Jobs")]
    public partial class Job
    {
        private int _JobId;
        private string _Name;
        private ISet _Employees;


        /// <summary>
        /// Database entity of JobId column
        /// This is also unique identifier of Jobs table
        /// </summary>
        [NHMA.Id(1, Name="JobId", Column = "JobId")]
        [NHMA.Generator(2, Class = "native")]
        public virtual int JobId
        {
            get { return this._JobId; }
            set { this._JobId = value; }		    
        }        
 
        /// <summary>
        /// Database entity of Name column
        /// </summary>
        [NHMA.Property(Column = "Name", NotNull=true)]
        public virtual string Name
        {
            get { return this._Name; }
            set { this._Name = value; }		    
        }        

        /// <summary>
        /// Database foreign key reference of relationship between Employees and Jobs tables
        /// Lazy initialized Set of Employee dtos
        /// </summary>        
        [NHMA.Set(1, Table = "Employees", Lazy = true, Inverse = true, Cascade = NHMA.CascadeStyle.All)]
        [NHMA.Key(2, Column = "JobId")]
        [NHMA.OneToMany(3, Class = "infoMECHANICA.NHibernateORM.TestMappings.Employee, infoMECHANICA.NHibernateORM.TestMappings")]
        public virtual ISet Employees
        {
            get
            {
                if (_Employees == null)
                {
                    _Employees = new HashedSet();
                }
                return _Employees;
            }
            set
            {
                _Employees = value;
            }
        }        
    }
}
